<nz-modal [(nzVisible)]="visible" [nzTitle]="detailItem.id ? '修改信息' : '新增信息'" [nzMaskClosable]="false"
  (nzOnCancel)="onCancel()" [nzFooter]="nzModalFooter" nzWidth="600">
  <form nz-form #eitorForm="ngForm">


    <nz-form-item>
      <nz-form-label nzFor="title" [nzSpan]="4" nzRequired>标题</nz-form-label>
      <nz-form-control [nzSpan]="15" [nzErrorTip]="titleaccout"
        [nzValidateStatus]="title.invalid && (title.dirty || title.touched) ? 'error' : ''" nzHasFeedback>
        <input #title="ngModel" autocomplete="off" nz-input [(ngModel)]="detailItem.title" name="title" placeholder="标题"
          required />
        <ng-template #titleaccout let-control>
          <ng-container *ngIf="title.hasError('required')">
            请输入标题!
          </ng-container>
        </ng-template>
      </nz-form-control>
    </nz-form-item>

    <nz-form-item class="mb-md">
      <nz-form-label nzFor="enterprise" [nzSpan]="4" nzRequired>企业单位</nz-form-label>
      <nz-form-control [nzSpan]="15" [nzErrorTip]="enterpriseerror"
        [nzValidateStatus]="enterprise.invalid && (enterprise.dirty || enterprise.touched) ? 'error' : ''"
        nzHasFeedback>
        <input #enterprise="ngModel" autocomplete="off" nz-input [(ngModel)]="detailItem.enterprise" name="enterprise"
          placeholder="企业单位" required />
        <ng-template #enterpriseerror let-control>
          <ng-container *ngIf="enterprise.hasError('required')">
            请输入企业单位!
          </ng-container>
        </ng-template>
      </nz-form-control>
    </nz-form-item>



    <nz-form-item>
      <nz-form-label name="date" [nzSpan]="5" nzRequired>消息起止时间</nz-form-label>
      <nz-form-control [nzErrorTip]="enterpriseerror"
        [nzValidateStatus]="date.invalid && (date.dirty || date.touched) ? 'error' : ''" nzHasFeedback [nzSpan]="14">
        <nz-range-picker [nzPlaceHolder]="['开始时间', '结束时间']" #date="ngModel" [(ngModel)]="dateTime" name="date"
          (ngModelChange)="onChange($event)" (nzOnOk)="onOk($event)">
        </nz-range-picker>

        <ng-template #timeeerror let-control>
          <ng-container *ngIf="date.hasError('required')">
            请选择消息起止时间!
          </ng-container>
        </ng-template>
      </nz-form-control>
    </nz-form-item>


    <nz-form-item class="mb-md">
      <nz-form-label nzFor="content" [nzSpan]="4" nzRequired>消息内容</nz-form-label>
      <nz-form-control [nzSpan]="15" [nzErrorTip]="contenteerror"
        [nzValidateStatus]="content.invalid && (content.dirty || content.touched) ? 'error' : ''" nzHasFeedback>
        <textarea #content="ngModel" autocomplete="off" nz-input [(ngModel)]="detailItem.content" name="content"
          placeholder="消息内容" required>
         </textarea>
        <ng-template #contenteerror let-control>
          <ng-container *ngIf="content.hasError('required')">
            请输入消息内容!
          </ng-container>
        </ng-template>
      </nz-form-control>
    </nz-form-item>


    <nz-form-item class="mb-md">
      <nz-form-label nzFor="type" [nzSpan]="4" nzRequired>消息类型</nz-form-label>
      <nz-form-control [nzSpan]="15" [nzErrorTip]="typeteerror"
        [nzValidateStatus]="type.invalid && (type.dirty || type.touched) ? 'error' : ''" nzHasFeedback>
        <input #type="ngModel" autocomplete="off" nz-input [(ngModel)]="detailItem.type" name="type" placeholder="消息类型"
          required />
        <ng-template #typeteerror let-control>
          <ng-container *ngIf="type.hasError('required')">
            请输入消息类型!
          </ng-container>
        </ng-template>
      </nz-form-control>
    </nz-form-item>
  </form>
  <ng-template #nzModalFooter>
    <button nz-button nzType="default" (click)="onCancel()">取消</button>
    <button nz-button nzType="primary" [nzLoading]="loading" (click)="validate(true)"
      [acl]="['MESSAGES_CREATE', 'MESSAGES_UPDATE']">
      确定
    </button>
  </ng-template>
</nz-modal>
